package com.example.sbbsec.quartz.entity.schedule;

import com.example.sbbsec.quartz.entity.Job;
import com.example.sbbsec.quartz.executor.AbstractJobExecutor;
import com.google.common.base.MoreObjects;
import org.quartz.Scheduler;

import static com.example.sbbsec.quartz.util.QuartzConstant.EMPTY_STRING;


/**
 * 任务信息
 *
 * @author lowe.yang
 * @date 2019-01-04 10:37
 */
public class ScheduleJob extends Job {
    public ScheduleJob() {
        super();
    }

    public ScheduleJob(String jobName) {
        super(jobName);
    }

    public ScheduleJob(String jobName, Class<? extends AbstractJobExecutor> executor) {
        super(jobName);
        this.executor = executor;
    }

    //执行类
    private Class<? extends AbstractJobExecutor> executor;

    //任务名称 用于修改
    private String oldJobName = EMPTY_STRING;
    //任务分组 用于修改
    private String oldJobGroup = Scheduler.DEFAULT_GROUP;

    public Class<? extends AbstractJobExecutor> getExecutor() {
        return executor;
    }

    public void setExecutor(Class<? extends AbstractJobExecutor> executor) {
        this.executor = executor;
    }

    public String getOldJobName() {
        return oldJobName;
    }

    public void setOldJobName(String oldJobName) {
        this.oldJobName = oldJobName;
    }

    public String getOldJobGroup() {
        return oldJobGroup;
    }

    public void setOldJobGroup(String oldJobGroup) {
        this.oldJobGroup = oldJobGroup;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(super.toString())
                .add("executor", executor)
                .add("oldJobName", oldJobName)
                .add("oldJobGroup", oldJobGroup)
                .toString();
    }
}
